const {app, BrowserWindow} = require('electron')
const {join} = require('path')

const env = app.isPackaged ? 'production' : 'development'
const indexHtml = {
    development: 'http://localhost:5173',
    production: join(__dirname, '../dist/index.html')
}

const createWindow = () => {
    const win = new BrowserWindow({
        width: 1000,
        height: 800
    })

    win.loadURL(indexHtml[env])

    // ctrl + shift + i 打开控制台调试工具
    win.webContents.openDevTools()
}

app.whenReady().then(() => {
    createWindow()
})
